﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL.Artwork;

namespace WebApplication.User
{
    public partial class Arts : System.Web.UI.Page
    {

        private ArtworkService artworkService = new ArtworkService();

        public List<Models.Artworks> artworks = null;

        private void HandleArtwork()
        {
            int totalCount = 0;

            int queryId = Convert.ToInt32(Request.QueryString["id"]);

            // Not Login
            if (Session["UID"] == null)
            {
                artworks = artworkService.GetList(ref totalCount, queryId, 1, 999, "LikeCount Desc");
                return;
            }
            int uid = Convert.ToInt32(Session["UID"]);
            artworks = artworkService.GetList(ref totalCount, queryId, 1, 999, "LikeCount Desc");
            artworkService.QueryIsLiked(uid, artworks);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            HandleArtwork();
        }
    }
}